﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using devtm.Applications.License;

namespace devtm.Applications.Implementation
{
    public class Server : devtm.Applications.IApplicationOperationContract
    {

        public ApplicationRegisterModelBack Register(ApplicationRegisterModel model)
        {

            ApplicationRegisterModelBack back = new ApplicationRegisterModelBack();

            try
            {         

                // new Guid(model.GuidApplication), 
                LicenseModel modellicense = new LicenseModel() { GuidApplication = new Guid(model.GuidApplication), GuidUser = new Guid(model.GuidUser) };

                back.License = License.LicenseHelper.Create(modellicense);
                back.Result = true;
                
            }
            catch (Exception)
            {
                back.Result = false;
                back.ErrorMessage = "Error on register.";
            }

            return back;

        }



        public bool LogError(ApplicationErrorModel model)
        {

            return true;

        }


        public string Informations(ApplicationInformationsModel model)
        {

            return "";

        }
    }
}
